﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Phone.Controls;
using System.Xml.Linq;
using MyDemos.Classes;
using System.Text;
using System.Windows.Resources;
using System.IO;
using System.Globalization;
using MyDemos.Utils;
using System.Diagnostics;
using System.Text.RegularExpressions;

namespace MyDemos.Demos
{
    public partial class RSSDemo : PhoneApplicationPage
    {

        public static Dictionary<int, int> mBIG5_Unicode_MAP = new Dictionary<int, int> ();
        private Dictionary<String, RSSItem> mRssDictionary = new Dictionary<String, RSSItem> ();
        RssReader mReader;


        public RSSDemo ()
        {
            InitializeComponent ();

            string url = "http://www.businessweekly.com.tw/feednews.php";

            mReader = new RssReader (Dispatcher, url, () =>
            {
                mRssDictionary = mReader.GetResult ();
                RSSItem _Item = mRssDictionary[DateTime.Today.ToShortDateString()];


                RssParseUtil _RssUtil = new RssParseUtil (_Item.Description);
                List<RssContent> _RssList = _RssUtil.GetRssList ();

                cListBox.ItemsSource = _RssList;
            });
        }

        protected override void OnNavigatedTo (System.Windows.Navigation.NavigationEventArgs e)
        {





            base.OnNavigatedTo (e);
        }
    }
}